package com.sy.myknowledgebase.controller;


import com.sy.myknowledgebase.Vo.EbookVo;
import com.sy.myknowledgebase.Vo.PageVo;
import com.sy.myknowledgebase.Vo.Result;
import com.sy.myknowledgebase.Vo.params.EbookParam;
import com.sy.myknowledgebase.dao.pojo.Ebook;
import com.sy.myknowledgebase.service.EbookService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/ebook")
public class EbookController {

    @Autowired  // @Resource也可以
    private EbookService ebookService;

    /**
     * 查询所有的书单信息
     * @return
     */
    @GetMapping("list")
    public Result list(EbookParam ebookParam) {
        Result<PageVo<EbookVo>> result = new Result<>();
        PageVo<EbookVo> list = ebookService.list(ebookParam);
        result.setContent(list);
        return result;
    }
}
